package com.ideasindustry.photoontaje.utils;

import java.awt.Image;

public class ImageMathUtils {
	
	public static int[] calculateAspectRatio(Image image, int width, int height){
		
		// Make sure the aspect ratio is maintained, so the image is not skewed
		double thumbRatio = (double) width / (double) height;
		int imageWidth = image.getWidth(null);
		int imageHeight = image.getHeight(null);
		double imageRatio = (double) imageWidth / (double) imageHeight;
		if (thumbRatio < imageRatio) {
			thumbHeight = (int) (thumbWidth / imageRatio);
		} else {
			thumbWidth = (int) (thumbHeight * imageRatio);
		}
		
		return new int[2];
		
	}
	
}
